/**
 * @(#)com.pattern.p_02_observer.observer.TestObserver
 *
 * Copyright (c) 2014-2018 上海纬视瑞科技有限公司
 *
 * DESC:
 *
 */
package com.pattern.p_02_observer.observer;

/**
 * @author fusf
 * @version 1.0  2016/11/3
 */
public class TestObserver {

    public static void main(String[] args) {
        ConcreteSubject concreteSubject = new ConcreteSubject();
        ConcreteObserver concreteObserver1 = new ConcreteObserver(concreteSubject,"A");
        ConcreteObserver concreteObserver2 = new ConcreteObserver(concreteSubject,"B");
        ConcreteObserver concreteObserver3 = new ConcreteObserver(concreteSubject,"C");
        concreteSubject.setSubjectState("ReadOnly");
        concreteSubject.attach(concreteObserver1);
        concreteSubject.attach(concreteObserver2);
        concreteSubject.attach(concreteObserver3);
        concreteSubject.notifyObservers();
    }
}
